package com.itboye.lottery.adapter;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.itboye.lottery.R;
import com.itboye.lottery.bean.FollowOrderDetailBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by  HONGDA on 2018/6/19.
 */
public class HotPeopleDetailFollowListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private Activity context;
    public List<FollowOrderDetailBean.FollowUserEntity.FollowUserEntity2> mData = new ArrayList<>();
    private LayoutInflater inflater;

    public HotPeopleDetailFollowListAdapter(Activity context, List<FollowOrderDetailBean.FollowUserEntity.FollowUserEntity2> mData) {
        this.context = context;
        this.mData = mData;
        inflater = LayoutInflater.from(context);
    }


    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.item_fragment_follow_people, parent, false);
        FollowViewHolder holder = new FollowViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        FollowViewHolder viewHolder = (FollowViewHolder) holder;
        if (mData != null) {
            FollowOrderDetailBean.FollowUserEntity.FollowUserEntity2 followUserEntity = mData.get(position);
            viewHolder.tv_username.setText(followUserEntity.getNickname());
            viewHolder.tv_one_money.setText(followUserEntity.getAmount());
            viewHolder.tv_jiangjin.setText(followUserEntity.getPrize_money());
            viewHolder.tv_yongjin.setText(followUserEntity.getCommission() + "");
//            ((HotPeopleViewHolder) holder).init(str);
        }
//        holder.textView.setText(str);
    }

    @Override
    public int getItemCount() {
        return mData == null ? 0 : mData.size();
    }


    public class FollowViewHolder extends RecyclerView.ViewHolder {

        TextView tv_username;
        TextView tv_one_money, tv_jiangjin, tv_yongjin;
        TextView mTvLeast;
        EditText mTvGroupBuyDes;
        TextView mTvGroupBuyMoney;

        TextView mTvFollowNumber;

        TextView mTvFollow;

        TextView mRlAwardNumber, tv_danbeijine;
        RelativeLayout mRlAwardBg;
        View view;
        RelativeLayout rl_bei;
        ImageView iv_type;
        TextView item_hotpeople_total_money;
        LinearLayout beizhu;

        public FollowViewHolder(View itemView) {
            super(itemView);
            view = itemView;
            tv_username = itemView.findViewById(R.id.tv_username);
            tv_one_money = itemView.findViewById(R.id.tv_one_money);
            tv_jiangjin = itemView.findViewById(R.id.tv_jiangjin);
            tv_yongjin = itemView.findViewById(R.id.tv_yongjin);
//            mTvGroupBuyDes = itemView.findViewById(R.id.tv_group_buy_des);
//            mTvGroupBuyMoney = itemView.findViewById(R.id.tv_group_buy_money);
//            mTvFollowNumber = itemView.findViewById(R.id.tv_follow_number);
//            mTvFollow = itemView.findViewById(R.id.tv_follow);
//            mRlAwardNumber = itemView.findViewById(R.id.rl_award_number);
//            mRlAwardBg = itemView.findViewById(R.id.rl_award_bg);
//            rl_bei = itemView.findViewById(R.id.rl_bei);
//            item_hotpeople_total_money = itemView.findViewById(R.id.item_hotpeople_total_money);
//            tv_jiangjin = itemView.findViewById(R.id.tv_jiangjin);
//            tv_danbeijine = itemView.findViewById(R.id.tv_danbeijine);
//            beizhu = itemView.findViewById(R.id.beizhu);
        }
    }

}
